import 'package:flutter/material.dart';
import '../course/cource.dart';
import '../../widgets/drawer/grawer.dart';
import '../../widgets/tabbar/tabbar.dart';
import '../basic/basic.dart';
import '../layout/layout.dart';
import '../view/view.dart';

class Home extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 4, // 项目标签的数量
      child: Scaffold(
        appBar: AppBar(
          // 加上抽屉之后自动添加
          // leading: IconButton(
          //   icon: Icon(Icons.menu),
          //   tooltip: 'Navigration',
          //   onPressed: () => debugPrint("Navigration Pressed"),
          // ),
          title: Text("Flutter App 实战"),
          actions: <Widget>[
            IconButton(
              icon: Icon(Icons.search),
              tooltip: 'Search',
              onPressed: () => debugPrint("Search Pressed"),
            ),
            IconButton(
              icon: Icon(Icons.more_horiz),
              tooltip: 'MoreHoriz',
              onPressed: () => debugPrint("MoreHoriz Pressed"),
            )
          ],
          bottom: TabBar(
            unselectedLabelColor: Colors.black38,
            indicatorColor: Colors.black54,
            indicatorSize: TabBarIndicatorSize.label,
            indicatorWeight: 1.0,
            tabs: <Widget> [
              Tab(icon: Icon(Icons.code)),
              Tab(icon: Icon(Icons.text_fields)),
              Tab(icon: Icon(Icons.list)),
              Tab(icon: Icon(Icons.view_quilt)),
            ],
          ),
        ),
        body: TabBarView(
          children: <Widget> [
            CourseWidget(),
            BasicWidget(),
            LayoutWidget(),
            ViewWidget(),
            // Icon(Icons.local_airport, size: 128.0, color: Colors.black12,),
            //Icon(Icons.accessibility, size: 128.0, color: Colors.black12,),
          ],
        ),
        backgroundColor: Colors.grey[100],
        drawer: DrawerWidget(),
        bottomNavigationBar: TabBarWidget(),
      )
    );
  }
}